package de.sashi.and.volumeprofiles;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;
import android.media.AudioManager;

/*
 * TODO:
 * - create table based on VolumeSetting
 * - create SQLite DB with 1 default record: "mute" -> set all vols to 0
 * - on selection of a profile, create/replace 1 record: "last"
 * - sort table by VolumeSetting.pos_
 * - extend from ListActivity and bind with CursorAdapter
 */
public class VolumeProfiles extends Activity {

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       TextView tv = (TextView) findViewById(R.id.maintextview);
       AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
       int ringVol = am.getStreamVolume(AudioManager.STREAM_RING);
       int musicVol = am.getStreamVolume(AudioManager.STREAM_MUSIC);
       int alarmVol = am.getStreamVolume(AudioManager.STREAM_ALARM);
       int notifVol = am.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
       int sysNotifVol = am.getStreamVolume(AudioManager.STREAM_SYSTEM);
       tv.setText(
               "ringer vol: "+ringVol+"\n"+
               "music vol: "+musicVol+"\n"+
               "alarm vol: "+alarmVol+"\n"+
               "notification vol: "+notifVol+"\n"+
               "system-notifaction vol: "+sysNotifVol+"\n"+
               "--------------------------------------\n"
               );

   }
   
   
   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
       MenuInflater inflater = getMenuInflater();
       inflater.inflate(R.menu.mainview_options, menu);
       return true;
   }
   
   
   @Override
   public boolean onOptionsItemSelected(MenuItem item) {
       switch (item.getItemId()) {
   
       case R.id.optmen_save_current:
           TextView tv = (TextView) findViewById(R.id.maintextview);
           tv.setText("saved!\n");
           return true;
           
       default:
           return super.onOptionsItemSelected(item);
       }
   }   
}